﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="InfrastructureTest.cs" company="dimamartovoi">
//   Apache License
//   Version 2.0, January 2004
//   http://www.apache.org/licenses
// </copyright>
// <summary>
//   The infrastructure test.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Diagnostics;

using ActorModel.Infrastructure;

using NUnit.Framework;

namespace Infrastructure.Tests
{
    /// <summary>
    ///     The infrastructure test.
    /// </summary>
    [TestFixture]
    public class InfrastructureTest
    {
        #region Public Methods and Operators

        /// <summary>
        ///     The bootstrap 2 nodes with 1 connector on each.
        /// </summary>
        [Test]
        public void Bootstrap2NodesWith1ConnectorOnEach()
        {
            var nodeInitialState = new Dictionary<int, int> { { 0, 1 }, { 1, 2 } };
            var connectrosInfos = new Dictionary<int, ConnectorInfo<int>>
                                      {
                                          { 0, new ConnectorInfo<int>(100, 1) }, 
                                          { 1, new ConnectorInfo<int>(200, 0) }
                                      };

            var parameters = new EngineStartParameters<int>(2, 1, nodeInitialState, connectrosInfos, this.EvolutionFunc);
            var engineBootstrapper = new EngineBootstrapper<int>(parameters);
            IEngineFlowController<int> controller = engineBootstrapper.Initialize();
            Debug.WriteLine(controller[0].ToString());
            Debug.WriteLine(controller[1].ToString());
            controller.Evolute();
            Debug.WriteLine(controller[0].ToString());
            Debug.WriteLine(controller[1].ToString());
            controller.Evolute();
            Debug.WriteLine(controller[0].ToString());
            Debug.WriteLine(controller[1].ToString());
            controller.Evolute();
            Debug.WriteLine(controller[0].ToString());
            Debug.WriteLine(controller[1].ToString());
        }

        #endregion

        #region Methods

        /// <summary>
        /// The evolution func.
        /// </summary>
        /// <param name="s">
        /// The s.
        /// </param>
        /// <param name="enumerable">
        /// The enumerable.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        private IEnumerable<string> EvolutionFunc(string s, IEnumerable<string> enumerable)
        {
            return new List<string>();
        }

        /// <summary>
        /// The evolution func.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <param name="enumerable">
        /// The enumerable.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        private IEnumerable<int> EvolutionFunc(int i, IEnumerable<int> enumerable)
        {
            return new LinkedList<int>();
        }

        #endregion
    }
}